package com.ctsi.ssdc.mapper;

import com.ctsi.ssdc.entity.SocialRetailSales;
import com.ctsi.ssdc.entity.TradeAndServiceIndustry;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
@Mapper
public interface TradeAndServiceMapper1{
    /**
     * 分区镇社会消费品零售总额
     * @param year 年份
     * @param month 月份
     * @return List<SocialRetailSales>
     */
    @Select("select * from social_retail_sales where year(statisticalTime) = #{year} and month(statisticalTime) = #{month} order by monthOnMonth desc")
    public List<SocialRetailSales> getSocialRetailSales(@Param("year")int year, @Param("month")int month);

    /**
     * 限上批发业销售额
     * 限上零售业销售额
     * 限上住宿业营业额
     * 限上餐饮业营业额
     * 交通及营利性服务业营业额
     * 房地产销售收入
     * 房地产销售面积（万平方米）
     * @param year 年份（int）
     * @param indicators 指标 (String)
     * @return List<TradeAndServiceIndustry>
     */
    @Select("select * from trade_and_service_industry where indicators = #{indicators} and year(statisticalTime) = #{year} order by month(statisticalTime) asc")
    public List<TradeAndServiceIndustry> getTradeAndServiceByIndicators(@Param("year")int year, @Param("indicators")String indicators);


    /**
     * 头标：当月及当月累计
     * @param year 年份（int）
     * @param indicators 指标 (String)
     *@return TradeAndServiceIndustry
     */
    @Select("select * from trade_and_service_industry where year(statisticalTime) = #{year} and month(statisticalTime) = #{month} and indicators = #{indicators} limit 1")
    TradeAndServiceIndustry findMonthProduct(@Param("year")int year, @Param("month")int month, @Param("indicators")String indicators);
}
